<!DOCTYPE html>
<html lang="zh-Hans-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Vue生命周期:实例销毁</title>
    <script src="../vue.js"></script>
</head>
<body>
<h2>【例35】Vue生命周期:实例销毁</h2>
<hr>
<div id="app">
    在控制台执行：vm.$destroy()，查看效果
    <div ref="bbb">测试div：一万年太久、只争朝夕。</div>
</div>
<script>
    let vm = new Vue({
        el: '#app',
        data: {msg: '张三'},
        beforeDestroy() {
            console.log('销毁之前');
            console.log(this.$refs.bbb);
            console.log(this.msg);
            console.log(vm)
        },
        destroyed() {
            console.log('销毁之后');
            console.log(this.$refs.bbb);
            console.log(this.msg);
            console.log(vm)
        }
    })
</script>
<hr>
<p><a href="index.html">返回章节目录</a>
    <script>document.write(document.lastModified); </script>
</p>
</body>
</html>
